# app/main.py
from fastapi import FastAPI
from app.routers import chat, user, history, chat_ws
from fastapi.middleware.cors import CORSMiddleware
from app.routers import chat_ws, test_conn  
from app.core.events import register_events
from app.core.config import settings

app = FastAPI()
app.add_middleware(
    CORSMiddleware,
    allow_origins=["*"],  # 开发环境可用 *
    allow_credentials=True,
    allow_methods=["*"],
    allow_headers=["*"],
)
# 注册路由
app.include_router(chat.router, prefix="/chat")
app.include_router(chat_ws.router, prefix="/ws")
app.include_router(user.router, prefix="/user")
app.include_router(history.router, prefix="/history")
app.include_router(test_conn.router)


